Whole year
msgpernickperweekday<- count(messages, unick ,format(datetime,"%A"))
names(msgpernickperweekday) <- c("unick","weekday","n")
msgpernickperweekday$weekday <- factor(msgpernickperweekday$weekday, levels = c("lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche"))
ggplot(data=msgpernickperweekday,aes(reorder(unick,n),n,fill=weekday)) + coord_flip() + geom_bar(stat="identity") + ggtitle(sprintf("Number of messages per weekday for %s", (yeartoload))) + xlab("Username") + ylab("# of messages") + scale_fill_brewer(palette = "Blues")

jColors <- usercolors$color
names(jColors) <- usercolors$unick
ggplot(data=scoreshgt,aes(reorder(unick,hgtscore),hgtscore)) + geom_bar(stat='identity') + coord_flip() + ylab("HGT Score") + xlab("Username")+ ggtitle("HGT Scores per username") + aes(fill=unick)+ scale_fill_manual(values = jColors)+ guides(fill=FALSE)

msgpernickperhour<- count(messages, unick ,hour(datetime))
names(msgpernickperhour) <- c("unick","hour","n")
ggplot(data=msgpernickperhour, aes(x=hour,y=unick)) + geom_point(aes(size=n),pch=21) + aes(color=unick,fill=unick) + scale_fill_manual(values = jColors)+ ylab("# of messages") + ggtitle("Activity per hour for the whole year") + scale_x_continuous(breaks=1:24) + guides(color=FALSE,fill=FALSE)

msgperweekpernick <- count(messages, unick ,format(datetime,"%U"))
names(msgperweekpernick) <- c("unick","weeknumber","count")
ggplot(data=msgperweekpernick,aes(weeknumber,count,fill=unick)) + geom_bar(stat='identity')+ scale_fill_manual(values = jColors) + ggtitle("Number of messages per week & per nick") + xlab("Week Number") + ylab("Number of messages")

messages2 <- messages
messages2$msg <- as.numeric(nchar(messages2$msg))
messages2 <- messages2[,c(2,4)]
toplot <- aggregate(messages2$msg, by=list(messages2$unick), FUN="mean")
toplot <- toplot[,1:2]
names(toplot) <- c("Nick","averagecharpermsg")
ggplot(toplot,aes(x = Nick,y=averagecharpermsg)) + geom_bar(stat="identity") + coord_flip() + aes(fill=Nick) + scale_fill_manual(values = jColors) + guides(fill=FALSE) + ggtitle("Average number of chars per message") + xlab("Nick") + ylab("Average chars in message")

Word Cloud (2017) per nick
stopwordsFR <-as.character(read.csv("resources/stopwords-fr.txt", fileEncoding = "UTF-8", header=FALSE)$V1 )
search = "çñÄÂÀÁäâàáËÊÈÉéèëêÏÎÌÍïîìíÖÔÒÓöôòóÜÛÙÚüûùúµ"
replace = "cnaaaaaaaeeeeeeeeeiiiiiiiioooooooouuuuuuuuu"
#loop on very unick
for (unick in unique(messages$unick)){
msgClean <- messages[messages$unick==unick,]
msgClean$msg <- tolower(chartr(search,replace,msgClean$msg))
msgClean$msg <- str_replace_all(msgClean$msg, "[^[:alnum:]]", " ")
temp <- (unlist(strsplit(msgClean$msg," ")))
"%w/o%" <- function(x, y) x[!x %in% y] #-- x without y
temp <- temp %w/o% stopwordsFR
temp <- temp[temp!= ""]
temp <- as.data.frame(table(temp))
temp$temp <- as.character(temp$temp)
temp <- temp[nchar(temp$temp) > 3,]
cat(" \n###", unick, " \n")
layout(matrix(c(1, 2),ncol = 2), widths = c(1, 10))
par(mar=c(0,3,0,0))
plot.new()
wordcloud(temp$temp,temp$Freq,max.words =100, main="Title" , min.freq = 4
, random.order = FALSE, rot.per=0.35, colors=brewer.pal(8, "Dark2"))
text(x=0, y=0.5, unick, col=jColors[unick],cex=2,srt=90, font=2)
cat(" \n")
}
paf

logs

roux

lorent

vv

fesse

chaf

bz

aw

batto

gawel

letag

tony

maxba

natashaa

rylou

qn7o
